package com.chen.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chen.pojo.entry.Task;
import com.chen.pojo.vo.TaskVo;
import com.chen.pojo.vo.TaskWorkVo;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author chen
 * @version 1.0
 * @create_date 2025/8/20
 * 工单表映射
 */
public interface TaskMapper extends BaseMapper<Task> {
    /**
     * 搜索工单
     *
     * @param page     分页对象
     * @param taskCode 工单编号
     * @param status   工单状态
     * @param repair   是否是维修工单
     * @return 结果
     */
    Page<TaskVo> selectTaskList(Page<TaskVo> page, String taskCode, Integer status, Integer repair);

    /**
     * 查询工单详情
     *
     * @param taskId 工单id
     * @return 结果
     */
    TaskVo selectTaskInfoById(String taskId);

    Long selectRepairCount(LocalDate start, LocalDate end, String innerCode);

    List<TaskWorkVo> selectUserWorkTop10(LocalDate start, LocalDate end, Integer repair, String regionId);

    TaskWorkVo selectUserWork(Integer userId, LocalDateTime start, LocalDateTime end);
}
